<template>
  <div class="container">
    <div class="header">
      <div >
        <router-link :to="{name:'releaseJob'}" style="height:90px;width:100%;" class="header_top">
          <img :src="photo_url">
          <span>{{real_name}}</span>
          <span>{{tel}}</span>
          <span>></span>
        </router-link>
      </div>
      <ul class="header_bottom">
        <li>
          <div>{{position_num}}</div>
          <div>已发布</div>
        </li>
        <li>
          <div>{{position_state_num}}</div>
          <div>招聘中</div>
        </li>
        <li>
          <router-link to="/me/enterpriseList" style="line-height:22px;" v-if="!isCompany" class="guan">
              <div>{{isCompany ? company_attention: user_attention}}</div>
              <div>{{isCompany ?'关注的人数' :'关注的企业'}}</div>
          </router-link>
          <div v-else>
              <div>{{isCompany ?company_attention : user_attention}}</div>
              <div>{{isCompany ?'关注的人数' :'关注的企业'}}</div>
          </div>
        </li>
      </ul>
    </div>
    <ul class="details">
      <li>
        <router-link to="/me/authentication">
          <img src="http://file.rzkeji.com/web/recruit/icon/renzheng.png"/>
          <span class="details_title">认证信息</span>
          <span class="details_allow">></span>
        </router-link>
      </li>
      <!--<li v-if="!isCompany">-->
        <!--<router-link :to="{name:'resumeN'}">-->
          <!--<img src="http://file.rzkeji.com/web/recruit/icon/jianli.png"/>-->
          <!--<span class="details_title">发布信息</span>-->
          <!--<span class="details_allow">></span>-->
          <!--<span class="details_tip">{{resume==1 ?'已完善' :'未完善'}}</span>-->
        <!--</router-link>-->
      <!--</li>-->


      <li>
        <router-link to="/releaseJob">
          <img src="http://file.rzkeji.com/web/recruit/icon/jianli.png"/>
          <span class="details_title">发布信息</span>
          <span class="details_allow">></span>
          <!-- <span class="details_tip">{{resume==1 ?'已完善' :'未完善'}}</span> -->
        </router-link>
      </li>


      <!--<li>-->
        <!--<router-link to="/myRelease">-->
          <!--<img src="http://file.rzkeji.com/web/recruit/icon/fabu.png"/>-->
          <!--<span class="details_title">我的发布</span>-->
          <!--<span class="details_allow">></span>-->
          <!--&lt;!&ndash;<span class="details_tip">{{resume==1 ?'已完善' :'未完善'}}</span>&ndash;&gt;-->
        <!--</router-link>-->
      <!--</li>-->



      <!-- <li v-if="!isCompany" @click="setTopResume" class="setTopResume">
          <img src="http://file.rzkeji.com/web/recruit/icon/setTop.png"/>
          <span class="details_title">简历置顶</span>
          <span class="details_allow">></span>
          <span class="details_tip">{{resumeTop==1 ?'已置顶' :''}}</span>
      </li> -->
      <li>
        <router-link to="/me/releaseList">
          <img src="http://file.rzkeji.com/web/recruit/icon/zhaoshang.png"/>
          <span class="details_title">发布招商合作</span>
          <span class="details_allow">></span>
        </router-link>
      </li>
      <!-- <li>
        <router-link to="/me/resumeList">
          <img src="http://file.rzkeji.com/web/recruit/icon/message.png"/>
          <span class="details_title">简历收件箱</span>
          <span class="details_allow">></span>
        </router-link>
      </li> -->
      <li>
        <router-link to="/me/security">
          <img src="http://file.rzkeji.com/web/recruit/icon/anquan.png"/>
          <span class="details_title">安全设置</span>
          <span class="details_allow">></span>
        </router-link>
      </li>
      <li>
        <router-link to="/me/help">
          <img src="http://file.rzkeji.com/web/recruit/icon/help.png"/>
          <span class="details_title">帮助与反馈</span>
          <span class="details_allow">></span>
        </router-link>
      </li>
      <li>
        <router-link to="/me/aboutMe">
          <img src="http://file.rzkeji.com/web/recruit/icon/about.png"/>
          <span class="details_title">关于我们</span>
          <span class="details_allow">></span>
        </router-link>
      </li>
    </ul>
    <footerNav :select1="select"></footerNav>
  </div>

</template>

<script>
import footerNav from '@/components/footerNav'
export default {
  data () {
    return {
      photo_url:"http://file.rzkeji.com/web/recruit/icon/default.png",//个人头像
      real_name:"",//个人姓名
      tel:"",   //个人电话
      resume:"",            //  个人简历0：未填写 1：已填写
      company_auth:"",    //企业认证0：未认证1：已认证
      position_num:"",    //职位数量
      position_state_num:"",    //  招聘中的职位数量
      company_attention:"",    //关注的人数（企业）
      user_attention:"",    //关注的企业（个人）
      select:"4",
      resumeId:'',
      resumeTop:''
    }
  },
  components:{
    footerNav
  },
  computed: {
    isCompany(){ //判断是否为企业
      if(this.company_auth=='1'){
        return true
      }else{
        return false
      }
    },
  },

  methods: {
    // async getUserInfo(){
    //   var userToken=window.localStorage.getItem('userToken')
    //   let res=await this.$axios('/ucenter/getResume',{params:{user_token:userToken}})
    //   if(res.data.data instanceof Object){
    //   this.photo_url=res.data.data.user_info.photo_url
    //   this.real_name=res.data.data.user_info.realname
    //   this.tel=res.data.data.phone
    //   this.resumeId=res.data.data.id
    //   this.resumeTop=res.data.data.set_top
    //   }
    // },
    async getUserInfo(){
      const res=await this.$axios('/ucenter/getUserInfo')
      if(res.data.data instanceof Object){
        this.photo_url=res.data.data.user_info.photo_url
        this.real_name=res.data.data.user_info.realname
        this.tel=res.data.data.phone
        this.resumeId=res.data.data.id
        this.resumeTop=res.data.data.set_top
      }
    },
    async getJudCertDeta(){
      let userToken=window.localStorage.getItem('userToken')
      let personal=await this.$axios('/cert/judCertDeta',{params:{user_token:userToken}});
      let data=personal.data.data
      // this.company_auth=data.company_auth
      this.company_auth='0'
      this.resume=data.resumes
      this.position_num=data.position_num
      this.position_state_num=data.position_state_num
      this.company_attention=data.company_attention
      this.user_attention=data.user_attention
    },
    setTopResume(){
      this.$store.dispatch("setAdventType","resume")
      this.$router.push({name:'payment',params:{id:this.resumeId}})
    }
  },
  activated(){
    this.getUserInfo()
    this.getJudCertDeta()

  },

}
</script>

<style scoped>
.header{width: 100%;height: 180px;background-image: linear-gradient(-135deg, #57D1E2 0%, #37AED6 100%);}
.header_top{width: 100%;display: flex;justify-content: row;}
.header_top img{width: 50px;height: 50px;margin:20px;vertical-align: middle;border-radius: 50px; object-fit: cover;}
.header_top span{line-height: 90px;}
.header_top span:nth-of-type(1){font-size: 20px;color: #FFFFFF;}
.header_top span:nth-of-type(2){margin-left: 80px;font-size: 13px;color: #FFFFFF;}
.header_top span:nth-of-type(3){color:  #FFFFFF;flex:1;font-size: 20px;display: flex;justify-content: flex-end;margin-right:20px;}
.header_bottom{width: 100%;display: flex;justify-content: row;margin-top: 20px;}
.header_bottom li{flex: 1;text-align: center;color: #FFFFFF;border-right: 1px solid rgba(0,0,0,0.10);}
.header_bottom li:nth-of-type(3){border: 0;}
.header_bottom li div:nth-of-type(1){font-size: 17px;}
.header_bottom li div:nth-of-type(2){margin-top: 10px;font-size: 14px;}
.details{padding-bottom:60px;width: 100%;margin-top: 7px;background-color: #F8F8FB;}
.details li{width: 100%;height: 60px;margin-bottom: 1px;background-color: #fff;}
.details li img{width: 24px;height:24px;vertical-align: middle;margin-right: 10px;margin-left: 20px;}
.details_title{font-size: 17px;color: #000000;}
.details_tip,.details_allow{font-size: 14px;color: #D0021B;float: right;margin-right: 10px;}
.details_allow{color: #B2B2B9;font-size: 16px;}
a{height: 100%;line-height: 60px;}
.setTopResume{height: 100%;line-height: 60px;}
.guan{position: relative;color:#fff}
</style>
